package org.demo.utils;

import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;

import gnu.io.CommPortIdentifier;

public class ComUtils {
	
	public static String getComPort() {
		return "COM6";
	}
	
	public static List<String> getComPorts() {
		List<String> ports = new ArrayList<>();
		Enumeration<?> e = CommPortIdentifier.getPortIdentifiers();
		while (e.hasMoreElements()) {
			CommPortIdentifier commPortIdentifier = (CommPortIdentifier) e.nextElement();
			ports.add(commPortIdentifier.getName());
		}
		return ports;
	}

}
